<%@ page language="java" import="java.util.*,entity.*,Dao.*,factory.DaoFactory,Dao.Impl.*,java.sql.Date" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<HTML>
<HEAD>
<TITLE>员工
</TITLE>
<META http-equiv=Content-Type content="text/html;charset=utf-8" >
<META http-equiv=Pragma content=no-cache>
<META http-equiv=Cache-Control content=no-cache>
<META http-equiv=Expires content=-1000>

<LINK href="/OrderMeal/css/admin.css" type="text/css" rel="stylesheet">
<link href="/OrderMeal/css/layout.css" type="text/css" rel="stylesheet">
<script language="javascript">
function check(form){
	if (form.no.value==""){
		alert("请输入订单编号");
		return false;
	}

}
</script>
  </head>
  
  <body>
  <div id="container">
<div id="header"><jsp:include page="header.jsp"></jsp:include></div>
<div id="mainContent">
<div id="sidebar"><jsp:include page="waitersf.jsp"></jsp:include></div>
<div id="content">

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TR height=28>
    <TD background=/OrderMeal/Images/title_bg1.jpg>当前位置: 订单查询</TD></TR>
  <TR>
    <TD bgColor=#b1ceef height=1></TD></TR>
  <TR height=20>
    <TD background=/OrderMeal/Images/shadow_bg.jpg></TD></TR></TABLE>
    
  <center>
  <form name="content" method="post" action="servlet/OrderNoQuery.do" onsubmit="return check(content)">
  <table>
  <tr><h1>订单查询</h1></tr>
  <tr><td>订单编号：</td><td><input type="text" name="no" id="no"/></td></tr>
  <tr><td></td><td></td></tr>
  <tr><td align ="center"><input type="submit" name="submit" id="submit" value="提交"/></td>
      <td align="center"><input type="reset" name="reset" id="reset" value="重置"/></td></tr>
  </table>
  </form>
  </center>  
    
    
<% 
         Orders os = (Orders)request.getAttribute("order");
        %>

  <center>    
      
    <table width="100%">
    <tr background=/OrderMeal/Images/shadow_bg.jpg >
    <td width = "8%"><div align = "center">订单编号</div></td>
    <td width = "8%"><div align = "center">用户编号</div></td>
    <td width = "8%"><div align = "center">用户姓名</div></td>
    <td width = "8%"><div align = "center">员工编号</div></td>
    <td width = "8%"><div align = "center">员工姓名</div></td>    
    <td width = "8%"><div align = "center">菜品编号</div></td>
    <td width = "8%"><div align = "center">菜品名称</div></td>
    <td width = "8%"><div align = "center">菜品单价</div></td>
    <td width = "8%"><div align = "center">菜品份数</div></td>
    <td width = "8%"><div align = "center">餐桌编号</div></td>
    <td width = "8%"><div align = "center">订单日期</div></td>
    <td width = "8%"><div align = "center">订单总价</div></td>
    
    </tr>
    
    <%if(os!=null){
         ItemDao itd = DaoFactory.getItemDao();
         FoodsDao fd = DaoFactory.getFoodsDao();
         float sum = 0;
         int no = os.getOrder_no();
         List<Item> list = new ArrayList<Item> ();
         list = itd.getList(no);
         Waiters w = new Waiters();
         WaitersDao wd = DaoFactory.getWaitersDao();
         int wno = os.getWaiter_no();
         w = wd.get(wno);
         int uno = os.getUser_no();
         Users u = new Users();
         UsersDao ud = DaoFactory.getUsersDao();
         u = ud.get(uno);
    if(list != null){
		for(Object obj : list) {		
		Item i = (Item)obj;
		int no2 = i.getFood_no();
		Foods f = new Foods();
		f = fd.getFood(no2);
		
		%>
    <tr>
    <td width = "8%"><div align = "center"><%=os.getOrder_no() %></div></td>
    <td width = "8%"><div align = "center"><%=os.getUser_no() %></div></td>
    <td width = "8%"><div align = "center"><%=u.getUser_name() %></div></td>
    
    <td width = "8%"><div align = "center"><%=os.getWaiter_no() %></div></td>
    <td width = "8%"><div align = "center"><%=w.getWaiter_name() %></div></td>
    
    <td width = "8%"><div align = "center"><%=i.getFood_no() %></div></td>
    <td width = "8%"><div align = "center"><%=f.getFood_name() %></div></td>
    <td width = "8%"><div align = "center"><%=f.getFood_price() %></div></td>
    <td width = "8%"><div align = "center"><%=i.getMealNo() %></div></td>
    <td width = "8%"><div align = "center"><%=os.getTable_no() %></div></td>
    
    <td width = "8%"><div align = "center"><%=os.getDate()%></div></td>
    <td width = "8%"><div align = "center"></div></td>
   <%
   
   sum = sum + f.getFood_price()* i.getMealNo();
   }
	}%>
	
	  </tr>
    <tr background=/OrderMeal/Images/shadow_bg.jpg>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%"><div align = "center"></div></td>
  
    <td width = "8%"><div align = "center"></div></td>
    <td width = "8%" ><div align = "center"><%=sum %></div></td>
    </tr>
	<%} %>
	
  
    </table>
    
    </center>
    
    
    
    

    
 
    </div>
</div>

<div id="footer" align="center">版权所有    中北大学10060641  郭倩</div>

</div> 
  </body>
</html>
